package xiegd.study.proxy.jdk2;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author: xieguangda
 * @Description:
 * @Date: 2023/9/21 15:52
 */
public class MyInvocationHandler implements InvocationHandler {
    private Object target;

    public MyInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("Before method call..." + method.getName());
        Object result = method.invoke(target, args);
        System.out.println("After method call..." + method.getName());
        return result;
    }
}
